import 'dart:async';

import 'package:chopper/chopper.dart';
import 'package:example/swagger_generated_code/example.swagger.dart';

class MyAuthenticator implements Authenticator {
  @override
  FutureOr<Request?> authenticate(Request request, Response response, [Request? originalRequest]) {
    // TODO: implement authenticate
    throw UnimplementedError();
  }

  @override
  // TODO: implement onAuthenticationFailed
  AuthenticationCallback? get onAuthenticationFailed => throw UnimplementedError();

  @override
  // TODO: implement onAuthenticationSuccessful
  AuthenticationCallback? get onAuthenticationSuccessful => throw UnimplementedError();
}

void main() async {
  final example = Example.create(
    baseUrl: Uri.parse('http://localhost:3000'),
    authenticator: MyAuthenticator(),
  );

  final result = await example.appUsersGet(
    page: 1,
    pageSize: 10,
  );

  print(result.body?.data.list);

  final result2 = await example.appUsersIdGet(
    id: '68a074dc11c1319c9c7750e3',
  );
  print(result2.body?.data.username);

//   var result3=await example.appLedgerPost(body: body);
}
